<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>四六级在线报名系统-报名页面</title>
  <script src="js/jquery-3.3.1.min.js"></script>
	<link rel="stylesheet" href="layui/css/layui.css" media="all"></link>
	<script src="layui/layui.js"></script>
	<script src="layer/layer.js"></script>
	<link rel="stylesheet" href="layer/mobile/need/layer.css" />
	<link rel="stylesheet"  href="layer/theme/default/layer.css"/>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header" style="background-color: #F0F0F0;">
    <div class="layui-logo">
    	<img src="img/161230188.jpg"  height="90%"/>
    </div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
 </ul>
    <ul class="layui-nav layui-layout-right">
    	
    	     <li class="layui-nav-item"> <a href="cethome.html"><font size="5" color="#000">首页</font></a></li>
<li class="layui-nav-item"><a href="about.html" target="_self"><font size="5" color="#000">考试简介</font></a> </li>
<li class="layui-nav-item"><a href="time.html" target="_self"><font size="5" color="#000">考试动态</font></a> </li>
<li class="layui-nav-item"><a href="problems.html" target="_self"><font size="5" color="#000">常见问题</font></a> </li>
<li class="layui-nav-item"><a href="tips.html" target="_self"><font size="5" color="#000">温馨提示</font></a></li>
<li class="layui-nav-item"><a href="ulogin.html" target="_self"><font size="5" color="#000">登录系统</font></a></li>
<li class="layui-nav-item"><a href="register.html" target="_self"><font size="5" color="#000">报名注册</font></a></li>
    </ul>
  </div>
  
</div>   
</div>
 <script src="js/config.js"></script>
</div>
    <link rel="stylesheet" type="text/css" href="css/login.css">
</head>
<body>

<script src="js/jquery-3.3.1.min.js"></script>
	<script src="layer/layer.js"></script>
	<script src="layui/layui.js"></script>
<script src="js/config.js"></script>
	<link rel="stylesheet" href="layui/css/layui.css" />
	
	 <link rel="stylesheet" type="text/css" href="css/ulogin.css">
  <div align="center" style="margin-top:20px;">
	<div class="center_con1">
        <div class="center_con_left">
            <div class="sign_logo"></div>
            <div class="input_sign1" align="left">
                <div style="border: 1px solid #a7dbff; padding: 15px; margin-bottom: 20px; background-color: #e0effe; border-radius: 6px;">
                    <div class="input_sub" align="left">
                        <p style="margin-right: 15px; margin-left: 80px; font-size: 12px; color: #666; margin-bottom: 5px;">提示：邮箱为登录账号</p>
                        <label>电子邮箱：</label><input id="txtemail" onchange="check()" name="OrdinaryUserEmail" type="email" class="input_style">
                    </div>
                    <div class="input_sub1" align="left">
                        <label></label>
                    </div>
                    <div class="input_sub1" align="left">
                        <p style="margin-right: 50px; margin-left: 52px; font-size: 12px; color: #666; margin-top: 5px;">提示：密码长度为8-18位字符</p>
                        <label>密码：</label><input id="txtpassword" name="OrdinaryUserPassword" type="password" class="input_style">

                    </div>
                    
                </div>
                
                 
            </div>
            <div style="clear: both;"> </div>
            <div class="layui-form-item">
							<div class="layui-input-block">
							<button id="loginBtn" class="layui-btn " lay-submit="" onclick="login()" lay-filter="login">登录</button>
								<button class="layui-btn layui-btn-primary" type="reset">重置</button>
								
							</div>
						</div>
        </div>
  <div class="center_con_right">
            <div class="login_con">
                <div style="font-size: 18pt; padding-top: 10px; color: #333; font-size: 14px; margin-top: 50px; margin-left: 25px;" align="left">
                    <strong>没有账号,去注册：</strong>
                </div>
                <div align="center" style="margin-top: 35px;">
                	
                    <a href="register.html">
                           <input  type="button" class="layui-btn "  value="注册 " >
                    </a>
                </div>
                <div class="line_bg_sign"></div>
                <div class="other_select1" align="left">
                </div>
            </div>
        </div>
             <br>
    </div>
    
	</body>
	<script>
	
	
	 function check(){
		    var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); //正则表达式
		    var obj = document.getElementById("txtemail"); //要验证的对象
		    if(obj.value === ""){ //输入不能为空
		        layer.msg("输入不能为空!");
		        return false;
		    }else if(!reg.test(obj.value)){ //正则验证不通过，格式不对
		    	layer.msg("邮箱验证不通过!");
		        return false;
		    }else{
		        return true;
		    }
		}
		function login()
		{
//	 
		$.ajax({
			url: rooturl+"login",
			contentType: "application/json; charset=utf-8",  
		    dataType: "json",  
			type: "POST",
			async: true,
		    timeout: 50000,
			data: JSON.stringify({   
               "ordinaryUserEmail": $("#txtemail").val(),
                 "ordinaryUserPassword": $("#txtpassword").val() 				 
	        }),
			success: function(data) {
				 
				if(data.code == "1000")
					{
					layer.alert("操作成功", function() {
						layer.closeAll();
						var index = layer.load(1, {
  shade: [0.1,'#fff'] //0.1透明度的白色背景
});
						localStorage.setItem("cuser",JSON.stringify(data.obj));
						window.location.href="home.html";  
					});
				} else {
				  layer.alert(data.message);
				  $("#txtemail").val();
				  $("#txtpassword").val();
				}
			} ,
			  error: function() {
				layer.alert("操作请求错误，请您稍后再试", function() {
					layer.closeAll();
					//加载load方法
					 
				 
				});
			}  
		});
	}
		
	</script>
	 <div class="foot_con"></div>
        <div id="foot">Copyright <span style="font-size:18px;">©</span> 2017 </div>
    </div>
</html>
